************************************
***** Perspectives on Politics *****
****** Trump/Russia Analysis *******
************************************


cd "/Users/jdarr/Dropbox/Research/PCRG Portal/Portal 2/Trump Russia/Replication"

set more off

graph set window fontface "Times"

use "Portal 2 - Russia.dta", clear

xtset wave


*** Create margins-friendly labels ***
label var russia "Trump-Russia scandal news exposure"
label define russia 0"Less" 1"More"
label value russia russia


*******************************
****** Diagnostic tests *******
*******************************

** Hausman test: Random or fixed effects? **
xtreg trump_job_appr_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn, fe
estimates store fixed

xtreg trump_job_appr_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn, re
estimates store random

hausman fixed random



********************************
**** Table A1: Trump overall ****
********************************

* Column 1: effects on Trump job approval *
xtreg trump_job_appr_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn

estimates store T1C1

margins, by(russia) at (Rep_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("") /*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Trump job approval (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "Trump_Rep_Approval.gph", replace
graph export "Trump_Rep_Approval.png", replace
pwcompare i.russia##i.Rep_dum, effects

margins, by(russia) at (Dem_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("") /*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Trump job approval (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "Trump_Dem_Approval.gph", replace
graph export "Trump_Dem_Approval.png", replace
pwcompare i.russia##i.Dem_dum, effects

outreg2 using "Output/TA1_trump_overall_party.doc", se bdec(3) sdec(3)



* Column 2: Assessment of consequences of a Trump presidency *
xtreg trump_overall_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn

estimates store T1C2

margins, by(russia) at (Rep_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("") /*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Consequences of Trump (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "Trump_Rep_Consequences.gph", replace
graph export "Trump_Rep_Consequences.png", replace
pwcompare i.russia##i.Rep_dum, effects

margins, by(russia) at (Dem_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("") /*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Consequences of Trump (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "Trump_Dem_Consequences.gph", replace
graph export "Trump_Dem_Consequences.png", replace
pwcompare i.russia##i.Dem_dum, effects

outreg2 using "Output/TA1_trump_overall_party.doc", se bdec(3) sdec(3)


** Vertical coefficient plots **
coefplot (T1C1, label(Trump job approval) msize(small) ciopts(lcolor(black)) mcolor(black)) (T1C2, label(Consequences of a Trump presidency) msize(small) ciopts(lcolor(gray)) mcolor(gray)), vertical /*
	*/ keep(1.Rep_dum 1.Dem_dum) yline(0) title("(a) Baseline opinions (Trump-Russia stories removed)", size(medium)) xlabel(,labsize(medsmall))/*
	*/ yscale(range(-0.5 0.5)) ylabel(-0.5(0.1)0.5) graphregion(color(white)) plotregion(color(white)) bgcolor(white) msize(small) mcolor(gray) /*
	*/ coeflabels(, interaction (" * ") wrap(20)) legend(cols(1) size(medium) region(lstyle(none)))

graph save "F2a_TrumpAssessVertical.gph", replace
graph export "F2a_TrumpAssessVertical.png", replace


label drop russia
label define russia 0"Less Trump-Russia scandal" 1"More Trump-Russia scandal"
label value russia russia
	
coefplot (T1C1, label(Trump job approval) msize(small) ciopts(lcolor(black)) mcolor(black)) (T1C2, label(Consequences of a Trump presidency) msize(small) ciopts(lcolor(gray)) mcolor(gray)), vertical /*
	*/ keep(1.russia#1.Rep_dum 1.russia#1.Dem_dum) yline(0) title("(b) Difference from baseline opinions among those who saw" "more Trump-Russia stories", size(medium)) xlabel(,labsize(medsmall))/*
	*/ yscale(range(-0.2 0.2)) ylabel(-0.2(0.1)0.2) graphregion(color(white)) plotregion(color(white)) bgcolor(white) msize(small) mcolor(gray) /*
	*/ coeflabels(, interaction (" * ") wrap(20)) legend(cols(1) size(medium) region(lstyle(none)))

graph save "F2b_TrumpAssessVertical.gph", replace
graph export "F2b_TrumpAssessVertical.png", replace


graph combine "F2a_TrumpAssessVertical.gph" "F2b_TrumpAssessVertical.gph", col(1) row(2) xsize(4) ysize(6) title("Assessments of Trump Performance", size(medlarge)) graphregion(color(white)) plotregion(color(white))

graph save "Figure 2 - Trump assessments.gph", replace
graph export "Figure 2 - Trump assessments.png", replace



** Combined marginsplot **
graph combine "Trump_Rep_Approval.gph" "Trump_Rep_Consequences.gph", col(2) row(1) xsize(6) ysize(3) title("Republicans") graphregion(color(white))
graph save "F3a_Trump_Rep.gph", replace
graph export "F3a_Trump_Rep.png", replace

graph combine "Trump_Dem_Approval.gph" "Trump_Dem_Consequences.gph", col(2) row(1) xsize(6) ysize(3) title("Democrats") graphregion(color(white))
graph save "F3a_Trump_Dem.gph", replace
graph export "F3a_Trump_Dem.png", replace

graph combine "F3a_Trump_Rep.gph" "F3a_Trump_Dem.gph", col(1) row(2) graphregion(color(white))
graph save "Figure 3 - Trump assessments.gph", replace
graph export "Figure 3 - Trump asssessments.png", replace



*** Create margins-friendly labels ***
label drop russia
label define russia 0"Less" 1"More"
label value russia russia
	

	
	
	

	
******************************
**** Table A2: Emotions *******
******************************

** Emotions index, overall **
xtreg djt_emotions_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn

estimates store T2C1

outreg2 using "Output/TA2_trump_emotions_index_party.doc", se bdec(3) sdec(3)

margins, by(russia) at (Rep_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("")/*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Emotions towards Trump (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "DJT_Rep_AllEmo.gph", replace
graph export "DJT_Rep_AllEmo.png", replace
pwcompare i.russia##i.Rep_dum, effects

margins, by(russia) at (Dem_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("")/*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Emotions towards Trump (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "DJT_Dem_AllEmo.gph", replace
graph export "DJT_Dem_AllEmo.png", replace
pwcompare i.russia##i.Dem_dum, effects


* Russia weakens positive emotions for Trump among Republicans *
xtreg djt_pos_emo_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn

estimates store T2C2

margins, by(russia) at (Rep_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("")/*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Positive emotions towards Trump (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "DJT_Rep_PosEmo.gph", replace
graph export "DJT_Rep_PosEmo.png", replace
pwcompare i.russia##i.Rep_dum, effects

margins, by(russia) at (Dem_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("")/*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Positive emotions towards Trump (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "DJT_Dem_PosEmo.gph", replace
graph export "DJT_Dem_PosEmo.png", replace
pwcompare i.russia##i.Dem_dum, effects

outreg2 using "Output/TA2_trump_emotions_index_party.doc", se bdec(3) sdec(3)


xtreg djt_neg_emo_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn

estimates store T2C3

margins, by(russia) at (Rep_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("")/*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Negative emotions towards Trump (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "DJT_Rep_NegEmo.gph", replace
graph export "DJT_Rep_NegEmo.png", replace
pwcompare i.russia##i.Rep_dum, effects

margins, by(russia) at (Dem_dum=1)
marginsplot, plotopts(lpattern(dash)) yscale(range(0.4 0.8)) ylabel(0(0.1)0.8) xscale(range(-0.75 1.75)) title("")/*
	*/ xtitle("Trump-Russia news exposure", size(medium)) ytitle("Negative emotions towards Trump (0-1)", size(medium)) graphregion(color(white)) plotregion(color(white)) /*
	*/ bgcolor(white) graphregion(margin(vsmall)) xlabel(,labsize(medium)) scheme(s2mono)
graph save "DJT_Dem_NegEmo.gph", replace
graph export "DJT_Dem_NegEmo.png", replace
pwcompare i.russia##i.Dem_dum, effects

outreg2 using "Output/TA2_trump_emotions_index_party.doc", se bdec(3) sdec(3)



** Vertical coefficient plots **
coefplot (T2C1, label(Trump emotional index) msize(small) ciopts(lcolor(gs0)) msymbol(0h) mlcolor(black) mcolor(gs16)) (T2C2, label(Positive emotions towards Trump) msize(small) ciopts(lcolor(gs6)) mcolor(gs6)) /*
	*/ (T2C3, label(Negative emotions towards Trump) msize(small) ciopts(lcolor(gs12)) mcolor(gs12)), vertical /*
	*/ keep(1.Rep_dum 1.Dem_dum) yline(0) title("(a) Baseline opinions (Trump-Russia stories removed)", size(med)) ylabel(,labsize(small)) yscale(range(-0.5 0.5)) ylabel(-0.5(0.1)0.5) /*
	*/ graphregion(color(white)) plotregion(color(white)) bgcolor(white) msize(small) mcolor(gray) coeflabels(, interaction (" x ") wrap(20)) /*
	*/ legend(cols(1) size(medsmall) region(lstyle(none)))

graph save "F4a_TrumpEmotionsVertical.gph", replace
graph export "F4a_TrumpEmotionsVertical.png", replace


label drop russia
label define russia 0"Less Trump-Russia scandal" 1"More Trump-Russia scandal"
label value russia russia
	
coefplot (T2C1, label(Trump emotional index) msize(small) ciopts(lcolor(gs0)) msymbol(0h) mlcolor(black) mcolor(gs16)) (T2C2, label(Positive emotions towards Trump) msize(small) ciopts(lcolor(gs6)) mcolor(gs6)) /*
	*/ (T2C3, label(Negative emotions towards Trump) msize(small) ciopts(lcolor(gs12)) mcolor(gs12)), vertical /*
	*/ keep(1.russia#1.Rep_dum 1.russia#1.Dem_dum) yline(0) title("(b) Difference from baseline opinions among those who saw" "more Trump-Russia stories", size(med)) ylabel(,labsize(small)) yscale(range(-0.2 0.2)) ylabel(-0.2(0.1)0.2) /*
	*/ graphregion(color(white)) plotregion(color(white)) bgcolor(white) msize(small) mcolor(gray) coeflabels(, interaction (" x ") wrap(20)) /*
	*/ legend(cols(1) size(medsmall) region(lstyle(none)))

graph save "F4b_TrumpEmotionsVertical.gph", replace
graph export "F4b_TrumpEmotionsVertical.png", replace
	
	
graph combine "F4a_TrumpEmotionsVertical.gph" "F4b_TrumpEmotionsVertical.gph", col(1) row(2) xsize(4) ysize(6) title("Emotions towards President Trump", size(medlarge)) graphregion(color(white)) plotregion(color(white))

graph save "Figure 4 - Trump emotions.gph", replace
graph export "Figure 4 - Trump emotions.png", replace



** Combined marginsplot **
graph combine "DJT_Rep_AllEmo.gph" "DJT_Rep_PosEmo.gph" "DJT_Rep_NegEmo.gph", col(3) row(1) xsize(6) ysize(3) title("Republicans") graphregion(color(white))
graph save "F5a_DJT_Rep.gph", replace
graph export "F5a_DJT_Rep.png", replace

graph combine "DJT_Dem_AllEmo.gph" "DJT_Dem_PosEmo.gph" "DJT_Dem_NegEmo.gph", col(3) row(1) xsize(6) ysize(3) title("Democrats") graphregion(color(white))
graph save "F5a_DJT_Dem.gph", replace
graph export "F5a_DJT_Dem.png", replace

graph combine "F5a_DJT_Rep.gph" "F5a_DJT_Dem.gph", col(1) row(2) graphregion(color(white))
graph save "Figure 5 - Trump emotions.gph", replace
graph export "Figure 5 - Trump emotions.png", replace

	
	
	
	

**********************************
***** Table A3: Media bias ********
**********************************

xtreg msm_news_unbiased_index i.russia##Rep_dum i.russia##Dem_dum i.immigration i.defenseOfJourn i.factcheck i.intraparty

estimates store T3C1

outreg2 using "Output/TA3_Media_party.doc", se bdec(3) sdec(3)

xtreg msm_news_trust_index i.russia##Rep_dum i.russia##Dem_dum i.immigration i.defenseOfJourn i.factcheck i.intraparty

estimates store T3C2

outreg2 using "Output/TA3_Media_party.doc", se bdec(3) sdec(3)

xtreg msm_news_fair_index i.russia##Rep_dum i.russia##Dem_dum i.immigration i.defenseOfJourn i.factcheck i.intraparty

estimates store T3C3

outreg2 using "Output/TA3_Media_party.doc", se bdec(3) sdec(3)


** Vertical coefficient plots **
coefplot (T3C1, label(Unbiased) msize(small) ciopts(lcolor(gs0)) msymbol(0h) mlcolor(black) mcolor(gs16)) (T3C2, label(Trusted) msize(small) ciopts(lcolor(gs6)) mcolor(gs6)) /*
	*/ (T3C3, label(Fair) msize(small) ciopts(lcolor(gs12)) mcolor(gs12)), vertical /*
	*/ keep(1.Rep_dum 1.Dem_dum) yline(0) title("(a) Baseline opinions (Trump-Russia stories removed)", size(med)) ylabel(,labsize(small)) yscale(range(-0.5 0.5)) ylabel(-0.5(0.1)0.5) /*
	*/ graphregion(color(white)) plotregion(color(white)) bgcolor(white) msize(small) mcolor(gray) coeflabels(, interaction (" * ") wrap(20))/*
	*/ legend(rows(1) size(medsmall) region(lstyle(none)))

graph save "F6a_MediaAttitudesVertical.gph", replace
graph export "F6a_MediaAttitudesVertical.png", replace

coefplot (T3C1, label(Unbiased) msize(small) ciopts(lcolor(gs0)) msymbol(0h) mlcolor(black) mcolor(gs16)) (T3C2, label(Trusted) msize(small) ciopts(lcolor(gs6)) mcolor(gs6)) /*
	*/ (T3C3, label(Fair) msize(small) ciopts(lcolor(gs12)) mcolor(gs12)), vertical /*
	*/ keep(1.russia#1.Rep_dum 1.russia#1.Dem_dum) yline(0) title("(b) Difference from baseline opinions among those who saw" "more Trump-Russia stories", size(med)) ylabel(,labsize(small)) yscale(range(-0.2 0.2)) ylabel(-0.2(0.1)0.2) /*
	*/ graphregion(color(white)) plotregion(color(white)) bgcolor(white) msize(small) mcolor(gray) coeflabels(, interaction (" * ") wrap(20)) legend(rows(1) size(medsmall) region(lstyle(none)))
	
graph save "F6b_MediaAttitudesVertical.gph", replace
graph export "F6b_MediaAttitudesVertical.png", replace


graph combine "F6a_MediaAttitudesVertical.gph" "F6b_MediaAttitudesVertical.gph", col(1) row(2) xsize(4) ysize(6) title("Attitudes towards the Media", size(medlarge)) graphregion(color(white)) plotregion(color(white))

graph save "Figure 6 - Media attitudes.gph", replace
graph export "Figure 6 - Media attitudes.png", replace
	

*** Create margins-friendly labels ***
label drop russia
label define russia 0"Less" 1"More"
label value russia russia



********************************
** Table A4: Usage Moderation **
********************************

gen perc_russia_clicks = russiaClicks / russiaHits

xtreg trump_job_appr_index russia##Rep_dum russia##Dem_dum perc_russia_clicks i.immigration i.intraparty i.factcheck i.defenseOfJourn usagePropensity
outreg2 using "Output/TA4_Clicks_moderation_party.doc", se bdec(3) sdec(3)

estimates store T4C1


xtreg djt_emotions_index russia##Rep_dum perc_russia_clicks russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn usagePropensity
outreg2 using "Output/TA4_Clicks_moderation_party.doc", se bdec(3) sdec(3)

estimates store T4C2


*********************************
** Figure A7: Usage Moderation **
*********************************

** Vertical coefficient plots **
coefplot (T4C1, label(Trump job approval) msize(small) ciopts(lcolor(black)) mcolor(black)) (T4C2, label(Trump emotional index) msize(small) ciopts(lcolor(gray)) mcolor(gray)), vertical /*
	*/ keep(1.Rep_dum 1.Dem_dum) yline(0) title("(a) Baseline opinions (Trump-Russia stories removed)", size(medium)) xlabel(,labsize(medsmall))/*
	*/ yscale(range(-0.5 0.5)) ylabel(-0.5(0.1)0.5) graphregion(color(white)) plotregion(color(white)) bgcolor(white) msize(small) mcolor(gray) /*
	*/ coeflabels(, interaction (" * ") wrap(20)) legend(cols(1) size(medium) region(lstyle(none)))

graph save "F7a_TrumpAssessVertical.gph", replace
graph export "F7a_TrumpAssessVertical.png", replace

	
coefplot (T4C1, label(Trump job approval) msize(small) ciopts(lcolor(black)) mcolor(black)) (T4C2, label(Trump emotional index) msize(small) ciopts(lcolor(gray)) mcolor(gray)),  vertical /*
	*/ keep(1.russia#1.Rep_dum 1.russia#1.Dem_dum) yline(0) title("(b) Difference from baseline opinions among those who saw" "more Trump-Russia stories", size(medium)) xlabel(,labsize(medsmall))/*
	*/ yscale(range(-0.2 0.2)) ylabel(-0.2(0.1)0.2) graphregion(color(white)) plotregion(color(white)) bgcolor(white) msize(small) mcolor(gray) /*
	*/ coeflabels(, interaction (" * ") wrap(20)) legend(cols(1) size(medium) region(lstyle(none)))

graph save "F7b_TrumpEmotionsVertical.gph", replace
graph export "F7b_TrumpEmotionsVertical.png", replace


graph combine "F7a_TrumpAssessVertical.gph" "F7b_TrumpEmotionsVertical.gph", col(1) row(2) xsize(4) ysize(6) title("Trump-Russia Coverage Effects," "Controlling for Clicks and Usage", size(medlarge)) graphregion(color(white)) plotregion(color(white))

graph save "Figure 7 - Trump assessments with usage.gph", replace
graph export "Figure 7 - Trump assessments with usage.png", replace


xtreg msm_news_unbiased_index i.russia##Rep_dum i.russia##Dem_dum perc_russia_clicks i.immigration i.defenseOfJourn i.factcheck i.intraparty usagePropensity
outreg2 using "Output/TA4_Clicks_moderation_party.doc", se bdec(3) sdec(3)
xtreg msm_news_trust_index i.russia##Rep_dum i.russia##Dem_dum perc_russia_clicks i.immigration i.defenseOfJourn i.factcheck i.intraparty usagePropensity
outreg2 using "Output/TA4_Clicks_moderation_party.doc", se bdec(3) sdec(3)
xtreg msm_news_fair_index i.russia##Rep_dum i.russia##Dem_dum perc_russia_clicks i.immigration i.defenseOfJourn i.factcheck i.intraparty usagePropensity
outreg2 using "Output/TA4_Clicks_moderation_party.doc", se bdec(3) sdec(3)




**************************************
*** Table A5: Individual attitudes ***
**************************************

xtreg djt_proud_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA5_Appdx_emotions_party.doc", se bdec(3) sdec(3)

xtreg djt_enthusiastic_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA5_Appdx_emotions_party.doc", se bdec(3) sdec(3)

xtreg djt_hopeful_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA5_Appdx_emotions_party.doc", se bdec(3) sdec(3)

xtreg djt_anxious_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA5_Appdx_emotions_party.doc", se bdec(3) sdec(3)

xtreg djt_worried_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA5_Appdx_emotions_party.doc", se bdec(3) sdec(3)

xtreg djt_outraged_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA5_Appdx_emotions_party.doc", se bdec(3) sdec(3)

xtreg djt_angry_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA5_Appdx_emotions_party.doc", se bdec(3) sdec(3)

xtreg djt_fearful_index russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA5_Appdx_emotions_party.doc", se bdec(3) sdec(3)



****************************
*** Table A6: Logged DVs ***
****************************

xtreg log_djt_proud russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA6_Appdx_emotions_party_log.doc", se bdec(3) sdec(3)

xtreg log_djt_enthusiastic russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA6_Appdx_emotions_party_log.doc", se bdec(3) sdec(3)

xtreg log_djt_hopeful russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA6_Appdx_emotions_party_log.doc", se bdec(3) sdec(3)

xtreg log_djt_anxious russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA6_Appdx_emotions_party_log.doc", se bdec(3) sdec(3)

xtreg log_djt_worried russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA6_Appdx_emotions_party_log.doc", se bdec(3) sdec(3)

xtreg log_djt_outraged russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA6_Appdx_emotions_party_log.doc", se bdec(3) sdec(3)

xtreg log_djt_angry russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA6_Appdx_emotions_party_log.doc", se bdec(3) sdec(3)

xtreg log_djt_fearful russia##Rep_dum russia##Dem_dum i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA6_Appdx_emotions_party_log.doc", se bdec(3) sdec(3)




********************************
*** Table A7: Party strength ***
********************************

use "Portal 2 - Russia.dta", clear

xtset wave

keep if Rep_dum==1

xtreg djt_emotions_index russia i.pid_strength i.immigration i.intraparty i.factcheck i.defenseOfJourn

margins, by(russia pid_strength)


use "Portal 2 - Russia.dta", clear

xtset wave

keep if Dem_dum==1

xtreg djt_emotions_index russia i.pid_strength i.immigration i.intraparty i.factcheck i.defenseOfJourn

margins, by(russia pid_strength)


**************************************************
** Table A8: Selection into treatment analyses ***
**************************************************
set more off

use "Portal 2 - Russia wide.dta", clear

gen white1 = 1 if ethnicity1==0
replace white1 = 0 if ethnicity1!=0

gen black1 = 1 if ethnicity1==1
replace black1 = 0 if ethnicity1!=1

gen dropout = 1 if prc==.
replace dropout = 0 if dropout==.

gen trump_approver = 1 if trump_job_appr1 >= 6
replace trump_approver = 0 if trump_job_appr1 < 6

gen dem_trump_approver = 1 if trump_job_appr1 >= 6 & Dem_dum1==1
replace dem_trump_approver = 0 if trump_job_appr1 < 6


** Demographics predicting treatment **
reg russia Rep_dum1 Dem_dum1 age1 female1 i.education1 white1 black1
outreg2 using "Output/TA8_Russia selection.doc", se dec(3) alpha(0.05) symbol(*)

reg russia Rep_dum2 Dem_dum2 age1 female1 i.education1 white1 black1
outreg2 using "Output/TA8_Russia selection.doc", se dec(3) alpha(0.05) symbol(*)


***************************************
** Table A9: Portal dropout analyses **
***************************************

** Dropout analyses **
reg dropout russia Rep_dum1 Dem_dum1 i.immigration i.intraparty i.factcheck i.defenseOfJourn
outreg2 using "Output/TA9_Russia attrition.doc", se dec(3) alpha(0.05) symbol(*)

reg dropout russia i.immigration i.intraparty i.factcheck i.defenseOfJourn if Rep_dum1==1
outreg2 using "Output/TA9_Russia attrition.doc", se dec(3) alpha(0.05) symbol(*)

reg dropout russia i.immigration i.intraparty i.factcheck i.defenseOfJourn if Dem_dum1==1
outreg2 using "Output/TA9_Russia attrition.doc", se dec(3) alpha(0.05) symbol(*)

reg dropout russia i.immigration i.intraparty i.factcheck i.defenseOfJourn if trump_approver==1
outreg2 using "Output/TA9_Russia attrition.doc", se dec(3) alpha(0.05) symbol(*)




******************************
**** Table A10: Crosstabs ****
******************************

gen msm_news_unbiased_index1 = (msm_news_unbiased1 - 1)/6
gen msm_news_trust_index1 = (msm_news_trust1 - 1)/6
gen msm_news_fair_index1 = (msm_news_fair1 - 1)/6

gen msm_news_unbiased_index2 = (msm_news_unbiased2 - 1)/6
gen msm_news_trust_index2 = (msm_news_trust2 - 1)/6
gen msm_news_fair_index2 = (msm_news_fair2 - 1)/6


gen change_job_appr = trump_job_appr_index2 - trump_job_appr_index1
gen change_overall_index = trump_overall_index2 - trump_overall_index1
gen change_djt_emotions = djt_emotions_index2 - djt_emotions_index1
gen change_djt_pos_emo = djt_pos_emo_index2 - djt_pos_emo_index1
gen change_djt_neg_emo = djt_neg_emo_index2 - djt_neg_emo_index1
gen change_msm_unbiased = msm_news_unbiased_index2 - msm_news_unbiased_index1
gen change_msm_trust = msm_news_trust_index2 - msm_news_trust_index1
gen change_msm_fair = msm_news_fair_index2 - msm_news_fair_index1



** Trump job approval **
* Republicans *
tabstat trump_job_appr_index1, by(russia), if Rep_dum2==1 & dropout==0
tabstat trump_job_appr_index2, by(russia), if Rep_dum2==1 & dropout==0
tabstat change_job_appr, by(russia), if Rep_dum2==1 & dropout==0

* Democrats *
tabstat trump_job_appr_index1, by(russia), if Dem_dum2==1 & dropout==0
tabstat trump_job_appr_index2, by(russia), if Dem_dum2==1 & dropout==0
tabstat change_job_appr, by(russia), if Dem_dum2==1 & dropout==0


** Overall consequences of Trump **
* Republicans *
tabstat trump_overall_index1, by(russia), if Rep_dum2==1 & dropout==0
tabstat trump_overall_index2, by(russia), if Rep_dum2==1 & dropout==0
tabstat change_overall_index, by(russia), if Rep_dum2==1 & dropout==0

* Democrats *
tabstat trump_overall_index1, by(russia), if Dem_dum2==1 & dropout==0
tabstat trump_overall_index2, by(russia), if Dem_dum2==1 & dropout==0
tabstat change_overall_index, by(russia), if Dem_dum2==1 & dropout==0



** Emotions towards Trump index **
* Republicans *
tabstat djt_emotions_index1, by(russia), if Rep_dum2==1 & dropout==0
tabstat djt_emotions_index2, by(russia), if Rep_dum2==1 & dropout==0
tabstat change_djt_emotions, by(russia), if Rep_dum2==1 & dropout==0

* Democrats *
tabstat djt_emotions_index1, by(russia), if Dem_dum2==1 & dropout==0
tabstat djt_emotions_index2, by(russia), if Dem_dum2==1 & dropout==0
tabstat change_djt_emotions, by(russia), if Dem_dum2==1 & dropout==0



** Positive emotions towards Trump index **
* Republicans *
tabstat djt_pos_emo_index1, by(russia), if Rep_dum2==1 & dropout==0
tabstat djt_pos_emo_index2, by(russia), if Rep_dum2==1 & dropout==0
tabstat change_djt_pos_emo, by(russia), if Rep_dum2==1 & dropout==0

* Democrats *
tabstat djt_pos_emo_index1, by(russia), if Dem_dum2==1 & dropout==0
tabstat djt_pos_emo_index2, by(russia), if Dem_dum2==1 & dropout==0
tabstat change_djt_pos_emo, by(russia), if Dem_dum2==1 & dropout==0



** Negative emotions towards Trump index **
* Republicans *
tabstat djt_neg_emo_index1, by(russia), if Rep_dum2==1 & dropout==0
tabstat djt_neg_emo_index2, by(russia), if Rep_dum2==1 & dropout==0
tabstat change_djt_neg_emo, by(russia), if Rep_dum2==1 & dropout==0

* Democrats *
tabstat djt_neg_emo_index1, by(russia), if Dem_dum2==1 & dropout==0
tabstat djt_neg_emo_index2, by(russia), if Dem_dum2==1 & dropout==0
tabstat change_djt_neg_emo, by(russia), if Dem_dum2==1 & dropout==0



** Media variables **

** Unbiased **
* Republicans *
tabstat msm_news_unbiased_index1, by(russia), if Rep_dum2==1 & dropout==0
tabstat msm_news_unbiased_index2, by(russia), if Rep_dum2==1 & dropout==0
tabstat change_msm_unbiased, by(russia), if Rep_dum2==1 & dropout==0

* Democrats *
tabstat msm_news_unbiased_index1, by(russia), if Dem_dum2==1 & dropout==0
tabstat msm_news_unbiased_index2, by(russia), if Dem_dum2==1 & dropout==0
tabstat change_msm_unbiased, by(russia), if Dem_dum2==1 & dropout==0


** Trust **
* Republicans *
tabstat msm_news_trust_index1, by(russia), if Rep_dum2==1 & dropout==0
tabstat msm_news_trust_index2, by(russia), if Rep_dum2==1 & dropout==0
tabstat change_msm_trust, by(russia), if Rep_dum2==1 & dropout==0

* Democrats *
tabstat msm_news_trust_index1, by(russia), if Dem_dum2==1 & dropout==0
tabstat msm_news_trust_index2, by(russia), if Dem_dum2==1 & dropout==0
tabstat change_msm_trust, by(russia), if Dem_dum2==1 & dropout==0


** Fair **
* Republicans *
tabstat msm_news_fair_index1, by(russia), if Rep_dum2==1 & dropout==0
tabstat msm_news_fair_index2, by(russia), if Rep_dum2==1 & dropout==0
tabstat change_msm_fair, by(russia), if Rep_dum2==1 & dropout==0

* Democrats *
tabstat msm_news_fair_index1, by(russia), if Dem_dum2==1 & dropout==0
tabstat msm_news_fair_index2, by(russia), if Dem_dum2==1 & dropout==0
tabstat change_msm_fair, by(russia), if Dem_dum2==1 & dropout==0





****************************************************
*** Figure A1: Descriptive statistics for clicks ***
****************************************************

use "Portal 2 - Russia.dta", clear

xtset wave

gen perc_russia_clicks = russiaClicks / russiaHits

tabstat russiaClicks, by(PID), if russia==1 & prc!=.
tabstat perc_russia_clicks, by(PID), if russia==1 & prc!=.

kdensity perc_russia_clicks, graphregion(color(white)) bgcolor(white) title("Distribution of clicks on Trump-Russia stories") /*
	*/ xtitle("Clicks on Trump-Russia stories shown")
	
graph save "Figure A1 - Russia clicks distribution.gph", replace
graph export "Figure A1 - Russia clicks distribution.png", replace




*************************************************
*** Figure A2: Plots of demographic variables ***
*************************************************

use "Portal 2 - Russia.dta", clear

graph set window fontface "Times"

keep if wave==2


*** Label variables ***
label var age "Age"
label value age age

label var ethnicity "Race/Ethnicity"
label define ethnicity 0"Caucasian" 1"African American" 2"Pacific Islander" 3"Asian" 4"Hispanic" 5"Other"
label value ethnicity ethnicity

label var female "Gender"
label define female 0"Male" 1"Female" 2"Other
label value female female

label var education "Education"
label define education 0"None" 1"Eighth grade or below" 2"Some high school" 3"GED" 4"High school graduate" 5"Some college" 6"Four year graduate degree" 7"Graduate or professional degree"
label value education education


** Create categorical plots **
hist age, graphregion(color(white)) scheme(s2mono)
graph save "FA2_Age.gph", replace

catplot ethnicity, graphregion(color(white)) scheme(s2mono) ytitle("")
graph save "FA2_Ethnicity.gph", replace

catplot female, graphregion(color(white)) scheme(s2mono) ytitle("")
graph save "FA2_Gender.gph", replace

catplot education, graphregion(color(white)) scheme(s2mono) ytitle("")
graph save "FA2_Education.gph", replace


graph combine "FA2_Age.gph" "FA2_Gender.gph" "FA2_Ethnicity.gph" "FA2_Education.gph", graphregion(color(white)) col(1) xsize(4) ysize(9)
graph save "Figure A2 - Demographics combined.gph", replace
graph export "Figure A2 - Demographics combined.png", replace
